\documentclass{minimal}
\begin{document}

\begin{test1}
  \begin{test2}
    Hello world
  \end{test2}
\end{test1}

\begin{test1}
  Hello moon
\end{test1}

\end{document}
